package com.samphanie.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum QueryModeEnum {
    PAGE("page", "分页查询"),
    LIST("list", "列表查询"),
    TREE("tree", "树形列表"),
    CASCADE("cascade", "级联列表"), // 对应级联选择器的下拉格式数据
    ROUTER("router", "路由列表");;

    private String code;
    private String description;

    public static QueryModeEnum getByCode(String code) {
        for (QueryModeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return PAGE; // 默认分页查询
    }

}
